<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Javascript tests</title>
    <link rel="stylesheet" href="qunit-2.6.2.css">
</head>
<body>
<div id="qunit"></div>
<div id="qunit-fixture">
    <from>
        <input type="text" name="text">
        <div class="has-error">Error text</div>
    </from>
</div>


<script src="../jquery-3.3.1.js"></script>
<script src="../list.js"></script>
<script src="qunit-2.6.2.js"></script>
<script>

    console.log('qunit tests start');

    QUnit.test("errors should be hidden on keypress", function (assert) {
        window.Superlists.initialize();
        $('input[name="text"]').trigger('keypress');
        assert.equal($('.has-error').is(':visible'), false);
    });

    QUnit.test("errors aren't hidden if there is no keypress", function (assert) {
        window.Superlists.initialize();
        assert.equal($('.has-error').is(':visible'), true);
    })
</script>
</body>
</html>